/** 
 * Project Name:tinysql 
 * File Name:ConditionSymbol.java 
 * Package Name:com.wdy.golden.tinysql.plus 
 * Date:2021年4月26日上午10:16:53 
 * 
*/  
package com.wdy.golden.tinysql.plus;

import com.wdy.golden.tinysql.enmus.SqlSeparateType;

/** 
 * ClassName:ConditionSymbol <br/> 
 * Function: TODO ADD FUNCTION. <br/> 
 * Reason:   TODO ADD REASON. <br/> 
 * Date:     2021年4月26日 上午10:16:53 <br/> 
 * @author   DongYe_Wu 
 * @version
 * @see       
 */
public enum ConditionSymbol {

	GT(" > :%s ", 1),
	LT(" < :%s ", 2),
	GET(" >= :%s ", 3),
	LET(" <= :%s ", 4),
	EQ(" = :%s ", 5),
	NEQ(" <> :%s", 6),
	IN(" IN (:%s) ", 7),
	NOTIN(" NOT IN (:%s) ", 8),
	ISNULL(" IS NULL ", 9),
	ISNOTNULL(" IS NOT NULL ", 10),
	BOTHLIKE(" LIKE '%%' || :%s || '%%' ", 11),
	RIGTHLIKE(" LIKE '%%' || :%s || '' ", 12),
	LEFTLIKE(" LIKE '' || :%s || '%%' ", 13),
	;

	public String name;
	public int index;

	private ConditionSymbol(String name, int index) {
		this.name = name;
		this.index = index;
	}

	public static String getName(int index) {
		for (SqlSeparateType c : SqlSeparateType.values()) {
			if (c.getIndex() == index) {
				return c.name;
			}
		}
		return null;
	}
	
	public String getName() {
		return name;
	}

	public int getIndex() {
		return index;
	}
}
